import React from 'react';
import './ControlPanel.css';

export default function ControlPanel({ currentPlayer, winner, onUndo, onRestart, canUndo }) {
  return (
    <div className="control-panel">
      <div className="status">
        {winner === null && <span>当前玩家：<b className={currentPlayer === 0 ? 'p0' : 'p1'}>{currentPlayer === 0 ? '① 蓝方' : '② 红方'}</b></span>}
        {winner !== null && <span className="winner">胜者：<b className={winner === 0 ? 'p0' : 'p1'}>{winner === 0 ? '① 蓝方' : '② 红方'}</b></span>}
      </div>
      <button className="btn" onClick={onUndo} disabled={!canUndo}>悔棋</button>
      <button className="btn" onClick={onRestart}>重开</button>
    </div>
  );
} 